#include<bits/stdc++.h>
using namespace std;
const int N=1e5+5,mod=1e9+7;
long long n,a[N],ans,ans1,b[N],bj[N],d[N],mx,po;
void cheak()
{
	long long p=0,o;
	for(int i=1;i<=n;++i)
	{
		for(int j=i;j<=n;++j)
		{
			o=1;
			for(int z=i;z<=j;++z)
				if(d[z]!=d[j-z+i])
				{
					o=0;
					break;
				}
			p+=o;	 
		}
	}
	if(p>ans)
		ans=p,ans1=1;
	else if(p==ans)
		++ans1;
}
void dfs(int i)
{
	if(i==n+1)
	{
		cheak();
		return;
	}
	for(int j=1;j<=mx;++j)
	{
		if(bj[j])
		{
			--bj[j];
			d[i]=j;
			dfs(i+1);
			d[i]=0;
			++bj[j];
		} 
	} 
}
int main()
{
	freopen("palindrome.in","r",stdin);
	freopen("palindrome.out","w",stdout);
	ios::sync_with_stdio(false);
	cin.tie(0);
	cout.tie(0);
	cin>>n;
	for(int i=1;i<=n;++i)
		cin>>a[i],mx=max(mx,a[i]),++bj[a[i]];
	if(n<=10)
	{
		dfs(1);
		cout<<ans<<" "<<ans1;
	}
	else{
		for(int i=1;i<=mx;++i)
			ans+=(bj[i]+1)*bj[i]/2,po+=(bj[i]>=1);
		ans1=1;
		for(int i=1;i<=po;++i)
			ans1=(ans1*i)%mod;
		cout<<ans<<" "<<ans1;
	}
	return 0;
 } 
